#
# Makefile.in for Gauche/lib
#

.PHONY: all check install uninstall slibcat slibcat-in-place \
	clean distclean maintainer-clean

DESTDIR =

prefix      = @prefix@
exec_prefix = @exec_prefix@
bindir      = @bindir@
libdir      = @libdir@
srcdir      = @srcdir@
VPATH       = $(srcdir)
top_builddir = @top_builddir@
top_srcdir   = @top_srcdir@
datadir     = @datadir@
datarootdir = @datarootdir@
build       = @build@
host        = @host@

GAUCHE_DATA_DIR = $(datadir)/gauche-@GAUCHE_ABI_VERSION@
SCM_INSTALL_DIR = $(GAUCHE_DATA_DIR)/@GAUCHE_VERSION@/lib
INSTALL         = @INSTALL@
INSTALL_DATA    = @INSTALL_DATA@
MKINSTDIR       = $(top_srcdir)/mkinstalldirs
SLIB_DIR        = @SLIB_DIR@

GENERATED       = gauche/vm/insn.scm gauche/config.scm srfi/*
CONFIG_GENERATED = Makefile

SUBDIRS  = gauche gauche/vm gauche/serializer gauche/interactive gauche/mop \
           gauche/package gauche/cgen gauche/experimental gauche/test \
	   gauche/regexp \
	   srfi srfi/160 srfi-14 srfi-29 srfi-146 \
           binary control data dbd dbm math util compat file \
	   parser parser/peg rfc rfc/http \
	   scheme scheme/mapping scheme/stream scheme/vector \
           text text/unicode text/console www www/cgi lang lang/asm

# Note: srfi/*.scm is generated by src/srfis.scm

SCMFILES = \
       srfi-4.scm srfi-5.scm srfi-7.scm srfi-9.scm srfi-11.scm \
       srfi-14.scm srfi-14/query.scm srfi-14/set.scm srfi-18.scm \
       srfi-25.scm srfi-27.scm \
       srfi-29.scm srfi-29/bundle.scm srfi-29/format.scm \
       srfi-37.scm srfi-39.scm srfi-41.scm srfi-42.scm \
       srfi-55.scm srfi-60.scm srfi-64.scm \
       srfi-66.scm srfi-69.scm srfi-74.scm srfi-78.scm srfi-96.scm srfi-98.scm \
       srfi-99.scm srfi-101.scm srfi-106.scm \
       srfi-112.scm srfi-113.scm srfi-114.scm \
       srfi-115.scm srfi-117.scm srfi-118.scm \
       srfi-121.scm srfi-124.scm srfi-125.scm \
       srfi-127.scm srfi-128.scm srfi-129.scm \
       srfi-131.scm srfi-132.scm srfi-134.scm \
       srfi-141.scm srfi-143.scm srfi-146.scm srfi-146/hash.scm \
       srfi-151.scm srfi-152.scm srfi-154.scm srfi-155.scm srfi-158.scm \
       srfi-160.scm srfi/*.scm srfi/160/*.scm srfi-162.scm srfi-173.scm \
       slib.scm	 \
       check-script \
       gauche/test.scm gauche/test/generative.scm gauche/test/script.scm \
       gauche/time.scm gauche/connection.scm \
       gauche/redefutil.scm gauche/stringutil.scm \
       gauche/vecutil.scm gauche/condutil.scm gauche/portutil.scm \
       gauche/hashutil.scm gauche/treeutil.scm gauche/computil.scm \
       gauche/modutil.scm gauche/libutil.scm gauche/sortutil.scm \
       gauche/generic-sortutil.scm gauche/fileutil.scm gauche/sysutil.scm \
       gauche/regexp.scm gauche/regexp/sre.scm gauche/process.scm \
       gauche/signal.scm gauche/numerical.scm gauche/let-opt.scm \
       gauche/logical.scm \
       gauche/vm/debugger.scm gauche/vm/insn-core.scm gauche/vm/insn.scm \
       gauche/vm/profiler.scm \
       gauche/pputil.scm gauche/procedure.scm \
       gauche/serializer.scm gauche/serializer/aserializer.scm \
       gauche/parseopt.scm gauche/interactive.scm gauche/interactive/info.scm \
       gauche/interactive/init.scm \
       gauche/interactive/ed.scm gauche/interactive/toplevel.scm \
       gauche/interactive/editable-reader.scm \
       gauche/selector.scm gauche/logger.scm \
       gauche/common-macros.scm gauche/singleton.scm gauche/validator.scm \
       gauche/version.scm gauche/partcont.scm gauche/lazy.scm gauche/base.scm \
       gauche/interpolate.scm gauche/listener.scm \
       gauche/config.scm gauche/configure.scm gauche/reload.scm \
       gauche/mop/bound-slot.scm \
       gauche/mop/instance-pool.scm gauche/mop/validator.scm \
       gauche/mop/propagate.scm gauche/mop/singleton.scm \
       gauche/cgen.scm gauche/cgen/unit.scm gauche/cgen/literal.scm \
       gauche/cgen/cise.scm gauche/cgen/type.scm gauche/cgen/stub.scm \
       gauche/cgen/precomp.scm gauche/cgen/optimizer.scm \
       gauche/cgen/standalone.scm gauche/cgen/tmodule.scm \
       gauche/package.scm gauche/package/build.scm gauche/package/fetch.scm \
       gauche/package/util.scm gauche/package/compile.scm \
       gauche/experimental/ref.scm gauche/experimental/lamb.scm \
       gauche/experimental/app.scm \
       r7rs-setup.scm \
       binary/ftype.scm binary/pack.scm \
       control/job.scm control/mapper.scm control/thread-pool.scm \
       dbi.scm dbd/null.scm dbm.scm dbm/fsdbm.scm dbm/dump dbm/restore \
       data/cache.scm data/heap.scm \
       data/ideque.scm data/imap.scm data/priority-map.scm data/random.scm \
       data/ring-buffer.scm data/skew-list.scm data/trie.scm \
       lang/asm/x86_64.scm \
       math/const.scm math/prime.scm \
       util/isomorph.scm util/toposort.scm util/tree.scm util/queue.scm \
       util/digest.scm util/combinations.scm util/lcs.scm util/list.scm \
       util/record.scm util/relation.scm util/stream.scm util/trie.scm \
       util/rbtree.scm util/sparse.scm util/dominator.scm \
       util/levenshtein.scm util/unification.scm \
       compat/chibi-test.scm compat/jfilter.scm compat/stk.scm \
       compat/norational.scm compat/r7rs-srfi-tests.scm \
       file/filter.scm \
       rfc/mime-port.scm rfc/base64.scm rfc/uri.scm \
       rfc/cookie.scm rfc/quoted-printable.scm rfc/http.scm rfc/http/tunnel.scm \
       rfc/hmac.scm rfc/ftp.scm rfc/icmp.scm rfc/ip.scm rfc/json.scm \
       rfc/uuid.scm \
       scheme/base.scm scheme/box.scm scheme/bitwise.scm \
       scheme/case-lambda.scm scheme/char.scm scheme/charset.scm \
       scheme/comparator.scm scheme/complex.scm scheme/cxr.scm \
       scheme/division.scm scheme/ephemeron.scm scheme/eval.scm \
       scheme/file.scm scheme/fixnum.scm scheme/flonum.scm \
       scheme/generator.scm scheme/hash-table.scm scheme/ideque.scm \
       scheme/inexact.scm scheme/lazy.scm \
       scheme/list-queue.scm scheme/list.scm scheme/load.scm \
       scheme/lseq.scm scheme/mapping.scm scheme/mapping/hash.scm \
       scheme/process-context.scm scheme/r5rs.scm scheme/read.scm \
       scheme/regex.scm scheme/repl.scm scheme/rlist.scm \
       scheme/set.scm scheme/sort.scm \
       scheme/stream.scm scheme/stream/primitive.scm scheme/stream/derived.scm \
       scheme/time.scm \
       scheme/vector.scm scheme/write.scm \
       scheme/vector/base.scm scheme/vector/u8.scm scheme/vector/s8.scm \
       scheme/vector/u16.scm scheme/vector/s16.scm \
       scheme/vector/u32.scm scheme/vector/s32.scm \
       scheme/vector/u64.scm scheme/vector/s64.scm \
       scheme/vector/f32.scm scheme/vector/f64.scm \
       scheme/vector/c64.scm scheme/vector/c128.scm \
       text/csv.scm text/edn.scm text/parse.scm text/tree.scm text/sql.scm \
       text/html-lite.scm text/info.scm text/diff.scm \
       text/progress.scm \
       text/console.scm text/console/generic.scm text/console/windows.scm \
       text/gap-buffer.scm text/line-edit.scm text/template.scm \
       text/unicode.scm text/unicode/ucd.scm text/unicode/codeset.scm \
       www/cgi.scm www/cgi-test.scm www/cgi/test.scm www/css.scm

all:

check:

install:
	for d in $(SUBDIRS); do \
	  $(MKINSTDIR) "$(DESTDIR)$(SCM_INSTALL_DIR)/$$d"; \
	done
	for p in $(SCMFILES); do \
	  $(INSTALL_DATA) "$$p" "$(DESTDIR)$(SCM_INSTALL_DIR)/$$p"; \
	done
	if test -f slibcat; then \
	  $(INSTALL_DATA) slibcat "$(DESTDIR)$(SCM_INSTALL_DIR)/slibcat"; \
	fi

uninstall:

# If we have slib, creates catalog file for Gauche.   This should be called
# after everything is installed.
# For RPM, this has to be called in the postinstall script instead of
# installation script.
slibcat :
	if test -f $(SLIB_DIR)/require.scm && test $(build) = $(host) ; then \
	  $(exec_prefix)/bin/gosh -ftest -uslib -E"require 'new-catalog" -Eexit;\
	fi

# Some package systems don't allow to run postinstall commands.  For such
# systems, this target tries to create "slibcat" within this directory
# before installing gosh.
slibcat-in-place :
	if test -f $(SLIB_DIR)/require.scm; then \
	  $(SHELL) ./mklibcat $(top_builddir)/src/gosh ; \
	fi

clean:
	rm -rf core slibcat *.sci *~
	for d in $(SUBDIRS); do if test -d $$d; then (cd $$d; rm -f core *.sci *~); fi; done

distclean: clean
	rm -f $(CONFIG_GENERATED)

maintainer-clean: clean
	rm -f $(CONFIG_GENERATED) $(GENERATED)

